{% extends "main/base.html" %}
{% load i18n main_tag %}
{% block title %}{% trans '客户详情' %}{% endblock %}
{% block content %}
<div class="row">
    <aside class="profile-nav col-lg-3">
        <section class="panel">
            <div class="user-heading round">
                <h1>{{ object.name }}</h1>
                <p>{{ object.company }}</p>
            </div>
            <ul class="nav nav-pills nav-stacked">
                <li class="active"><a href=""> <i class="fa fa-user"></i> {% trans "客户详情" %} <span class="label label-danger pull-right r-activity">{{ object.order_count }}</span></a></li>
                {% if perms.main.change_client %}<li><a href="{% url 'main:client_update' object.pk %}"> <i class="fa fa-edit"></i> {% trans "编辑资料" %} </a></li>{% endif %}
            </ul>
        </section>
    </aside>
    <aside class="profile-info col-lg-9">
        <section class="panel">
            <div class="panel-heading">
                {% trans '基本信息' %}
            </div>
            <div class="panel-body bio-graph-info">
                <div class="row">
                    <div class="bio-row">
                        <p><span>{% trans '公司' %} </span>: {{ object.company }}</p>
                    </div>
                    <div class="bio-row">
                        <p><span>{% trans '手机' %} </span>: {{ object.mobile }}</p>
                    </div>
                    {% if object.fax %}
                    <div class="bio-row">
                        <p><span>{% trans '传真' %}</span>: {{ object.fax }}</p>
                    </div>
                    {% endif %}
                    {% if object.wechat %}
                    <div class="bio-row">
                        <p><span>{% trans '微信' %}</span>: {{ object.wechat }}</p>
                    </div>
                    {% endif %}
                    {% if object.email %}
                    <div class="bio-row">
                        <p><span>{% trans '邮箱' %}</span>: {{ object.email }}</p>
                    </div>
                    {% endif %}
                    {% if object.tax_code %}
                    <div class="bio-row">
                        <p><span>{% trans '税号' %}</span>: {{ object.tax_code }}</p>
                    </div>
                    {% endif %}
                    <div class="bio-row">
                        <p><span>{% trans '公司地址' %}</span>: {{ object.company_address|default_if_none:'N/A' }}</p>
                    </div>
                    <div class="bio-row">
                        <p><span>{% trans '邮寄地址' %}</span>: {{ object.post_address|default_if_none:'N/A' }}</p>
                    </div>
                </div>
            </div>
        </section>
        <section>
            <div class="row">
                {% if object.related_orders %}{% for od in object.related_orders %}
                {% if od.created_by_id == request.user.pk or request.user.is_staff or perms.main.view_all_orders %}
                <div class="col-lg-6">
                    <div class="panel">
                        <div class="panel-body">
                            <div class="bio-desk">
                                <a href="{% url 'main:order_detail' od.pk %}"><h4 class="red">{{ od.order_code }}</h4></a>
                                <p>{% trans '订单描述' %}: {{ od.order_desc }}</p>
                                <p>{% trans '订单日期' %}: {{ od.datetime_created|date:"Y-m-d" }}</p>
                                <p>{% trans '订单金额' %}: {{ od.price_with_tax|default_if_none:'0' }} 元</p>
                            </div>
                        </div>
                    </div>
                </div>
                {% endif %}
                {% endfor %}{% endif %}
            </div>
        </section>
    </aside>
</div>
{% endblock %}